package net.betou.cms.manager.main.impl;

import net.betou.cms.dao.main.CmsSiteCompanyDao;
import net.betou.cms.entity.main.CmsSite;
import net.betou.cms.entity.main.CmsSiteCompany;
import net.betou.cms.manager.main.CmsSiteCompanyMng;
import net.betou.common.hibernate3.Updater;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class CmsSiteCompanyMngImpl implements CmsSiteCompanyMng{
	public CmsSiteCompany save( CmsSite site, CmsSiteCompany bean ) {
		site.setSiteCompany( bean );
		bean.setSite( site );
		dao.save( bean );
		return bean;
	}

	public CmsSiteCompany update( CmsSiteCompany bean ) {
		Updater< CmsSiteCompany > updater = new Updater< CmsSiteCompany >( bean );
		bean = dao.updateByUpdater( updater );
		return bean;
	}

	private CmsSiteCompanyDao dao;

	@Autowired
	public void setDao( CmsSiteCompanyDao dao ) {
		this.dao = dao;
	}
}